package day1.how_to_create_thread_instance;
/**
 * 方法二：
 * Ⅰ.创建任务类，直接继承Thread类
 * Ⅱ.重写Thread类中的run方法
 * Ⅲ.实例化该任务类对象
 * Ⅳ.调用Thread的start方法启动该线程
 */
public class Extend_Thread {
    public static void main(String[] args) {

        Thread t1 = new PrintOne();
        Thread t2 = new PrintTwo();

        t1.start();
        t2.start();
    }
}

class PrintOne extends Thread {
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.print(1 + " ");
        }
    }
}

class PrintTwo extends Thread {
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.print(2 + " ");
        }
    }
}